using System;
using System.Collections.Generic;
using System.Text;

namespace ForumExplorer.Core.ObjectModel
{
    //The ForumUtility class contains methods that enable miscellaneous functionality for the ForumExplorer application
    public class ForumUtility
    {
        //Method:  GetPostIDFromURL
        //Parameters: string url - URL that points to the post in question
        //Returns:  the PostID # of the given question as an integer or 0 if the URL is not of a post on the forums
        public int GetPostIDFromURL(string url)
        {
            string[] splitURL = url.Split(new char[] { '&', '=', '?' });
            if (splitURL[1].ToLower() == "PostID".ToLower())
                return Convert.ToInt32(splitURL[2]);
            else
                return 0;
        }
    }
}
